home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
Issue51
/
Construc
/
DataMod.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1999-09-27
|
3KB
|
112 lines
unit DataMod;
interface
uses
Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom, DataBkr,
DBClient, Server51_TLB, StdVcl, Provider, Db, DBTables;
type
TTDM = class(TRemoteDataModule, ITDM)
CustomerTable: TTable;
OrdersTable: TTable;
CustomerTableCustNo: TFloatField;
CustomerTableCompany: TStringField;
CustomerTableAddr1: TStringField;
CustomerTableAddr2: TStringField;
CustomerTableCity: TStringField;
CustomerTableState: TStringField;
CustomerTableZip: TStringField;
CustomerTableCountry: TStringField;
CustomerTablePhone: TStringField;
CustomerTableFAX: TStringField;
CustomerTableTaxRate: TFloatField;
CustomerTableContact: TStringField;
CustomerTableLastInvoiceDate: TDateTimeField;
OrdersTableOrderNo: TFloatField;
OrdersTableCustNo: TFloatField;
OrdersTableSaleDate: TDateTimeField;
OrdersTableShipDate: TDateTimeField;
OrdersTableEmpNo: TIntegerField;
OrdersTableShipToContact: TStringField;
OrdersTableShipToAddr1: TStringField;
OrdersTableShipToAddr2: TStringField;
OrdersTableShipToCity: TStringField;
OrdersTableShipToState: TStringField;
OrdersTableShipToZip: TStringField;
OrdersTableShipToCountry: TStringField;
OrdersTableShipToPhone: TStringField;
OrdersTableShipVIA: TStringField;
OrdersTablePO: TStringField;
OrdersTableTerms: TStringField;
OrdersTablePaymentMethod: TStringField;
OrdersTableItemsTotal: TCurrencyField;
OrdersTableTaxRate: TFloatField;
OrdersTableFreight: TCurrencyField;
OrdersTableAmountPaid: TCurrencyField;
DataSource1: TDataSource;
CustomerOrdersProvider: TDataSetProvider;
Session1: TSession;
procedure CustomerOrdersProviderBeforeGetRecords(Sender: TObject;
var OwnerData: OleVariant);
procedure CustomerTableScroll(DataSet: TDataSet);
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
public
{ Public declarations }
end;
implementation
{$R *.DFM}
uses
MainUnit;
class procedure TTDM.UpdateRegistry(Register: Boolean; const ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ClassID, ProgID);
EnableSocketTransport(ClassID);
EnableWebTransport(ClassID);
end else
begin
DisableSocketTransport(ClassID);
DisableWebTransport(ClassID);
inherited UpdateRegistry(Register, ClassID, ProgID);
end;
end;
procedure TTDM.CustomerOrdersProviderBeforeGetRecords(Sender: TObject;
var OwnerData: OleVariant);
var
RecNo: Integer;
begin
if OwnerData <> '' then
begin
RecNo := OwnerData;
Log('Init: '+IntToStr(RecNo));
with (Sender AS TDataSetProvider) do
begin
DataSet.First;
while (RecNo > 0) and not DataSet.Eof do
begin
Dec(RecNo);
Log('Next: '+IntToStr(RecNo));
DataSet.Next
end
end
end
else Log('Empty!')
end;
procedure TTDM.CustomerTableScroll(DataSet: TDataSet);
begin
Log('AfterScroll: '+IntToStr(DataSet.RecNo))
end;
initialization
TComponentFactory.Create(ComServer, TTDM,
Class_TDM, ciMultiInstance, tmApartment);
end.